package com.woniuxy.config;

import com.woniuxy.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author dingpf
 * @version 1.0
 * @description
 * @create 2025/4/22 17:16
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Resource
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor) //自己拦截器
                .addPathPatterns("/**") //拦截规则
                .excludePathPatterns("/user/login","/book/queryAll") //免拦截路径
                .order(1); //执行顺序

    }
}
